****
****
* Do-File for Tables, Figures, Appendixes for 
* Peter Trubowitz and Brian Burgoon. (2020 forthcoming). "Retreat of the West" PERSPECTIVES ON POLITICS.
****
****

* Figure 2, Figure 3, Figure 5, Figure 6, Figure 7, Appendix Table A2, Appendix Figure A1, Appendix Figure A3 use "TBpopcntryyear.dta"
use "TBpopcountryyear.dta"

* Figure 4, Figure 8, Appendix Table A1, Appendix Table A3 use "TBmpd2018ipolatepartyyear.dta"
use "TBmpd2018ipolatepartyyear.dta"

* Appendix Figure A2 uses "TBpopyear.dta"
use "TBpopyear.dta"

****
****

* FIGURE 1 ("Structure of Western debate over international order"): Not statistical (see manuscript).

* FIGURE 2 ("Western support for international partnership and military power,1970-2016"):
use "TBpopcountryyear.dta"
tsset
sc kofpoleconDJwestGOOD lonemilexnewWestGOOD, ml(year2)
graph use "TBPopFig2.gph"

* FIGURE 3 ("Western support for international partnership and military power by major power, 1970-2016"):
use "TBpopcountryyear.dta"
tsset
sc kofpoleconDJUS lonemilexnewUS, ml(year2) || sc kofpoleconDJJ lonemilexnewJ, ml(year2) || sc kofpoleconDJeu lonemilexneweu, ml(year2)
graph use "TBPopFig3.gph"

*FIGURE 4: ("Party platform support for international partnership and military power by party family,1970-2017"):
use "TBmpd2018ipolatepartyyear.dta"
tsset party year
gr box lnetpartnership if fullwestgood==1&adjparfamadj>1&year>1969, over(adjparfamadj) noout 
gr box lnetpartnership if fullwestgood==1&adjparfamadj>1&year>1969&year<1991, over(adjparfamadj) noout 
gr box lnetpartnership if fullwestgood==1&adjparfamadj>1&year>1990, over(adjparfamadj) noout
gr box ilnetpromilgood if fullwestgood==1&adjparfamadj>1&year>1969, over(adjparfamadj) noout 
gr box ilnetpromilgood if fullwestgood==1&adjparfamadj>1&year>1969&year<1991, over(adjparfamadj) noout 
gr box ilnetpromilgood if fullwestgood==1&adjparfamadj>1&year>1990, over(adjparfamadj) noout

* FIGURE 5: ("Domestic support for international partnership in Western democracies, 1970-2016"):
use "TBpopcountryyear.dta"
sort year2
gr twoway line kofpoleconDJwestGOOD year if year>1969, yaxis(3) ||line lnetpartnervoteweightwestGOOD year if year>1969&year<2017, yaxis(1) || line mainminusradx3westGOOD year if year>1969&year<2017, yaxis(2)
graph use "TBPopFig5.gph"

* FIGURE 6: ("Domestic support for military power in Western democracies, 1970-2016")"
use "TBpopcountryyear.dta"
sort year2
gr twoway line lonemilexnewWestGOOD year if year>1969, yaxis(3) ||line linetpromilvoteweightwestGOOD year if year>1969&year<2017, yaxis(1) || line mainminusradx3westGOOD year if year>1969&year<2017, yaxis(2)
graph use "TBPopFig6.gph"

*FIGURE 7: ("Predicted international partnership and military power by mainstream party vote and weighted party platform support"):
use "TBpopcountryyear.dta"
tsset countrynew year2
xi: reg f.lkofpoleconDJ ipervoteMminRRRLcygood3 l4.kofgidfma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
margins, at(ipervoteMminRRRLcygood3 =(-5(5)100)) saving(marginsmanualmainmin, replace) 
marginsplot
xi: reg f.lkofpoleconDJ lnetpartnervoteweight l4.kofgidfma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
margins, at(lnetpartnervoteweight=(-49(5)120)) saving(lnetpartnervoteweightfig, replace)
marginsplot
xi: reg f.lmilexnew ipervoteMminRRRLcygood3 l4.lmilexnewma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
margins, at(ipervoteMminRRRLcygood3 =(-5(5)100)) 
marginsplot
xi: reg f.lmilexnew linetpromilvoteweight l4.lmilexnewma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
margins, at(linetpromilvoteweight=(-27(10)116))
marginsplot

*FIGURE 8: ("The Influence of Party platform supporting Partnership and supporting Power on Party-specific Electoral Gains, by Party Family"):
use "TBmpd2018ipolatepartyyear.dta"
tsset party year
xi: reg ipervote l.ipervote c.lnetpartnership##i.adjparfamadj  c.ilnetpromilgood  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
margins, dydx (lnetpartnership) at(adjparfamadj=(2(1)7))
marginsplot
xi: reg ipervote l.ipervote c.lnetpartnership  c.ilnetpromilgood##i.adjparfamadj  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
margins, dydx (ilnetpromilgood) at(adjparfamadj=(2(1)7))
marginsplot



*APPENDIX TABLE A1: ("Party platforms supporting international partnership and military power by party type"):
use "TBmpd2018ipolatepartyyear.dta"
tsset party year
reg lnetpartnership i.adjparfamadj  i.decades i.icountry if year>1969&fullwestgood==1, cl(icountry)
est store a1m1
reg lnetpartnership i.adjparfamadj  i.decades i.icountry if year>1969&year<1991&fullwestgood==1, cl(icountry)
est store a1m2
reg lnetpartnership i.adjparfamadj  i.decades i.icountry if year>1990&fullwestgood==1, cl(icountry)
est store a1m3
reg ilnetpromilgood i.adjparfamadj i.decades i.icountry if year>1969&fullwestgood==1, cl(icountry)
est store a1m4
reg ilnetpromilgood i.adjparfamadj  i.decades i.icountry if year>1969&year<1991&fullwestgood==1, cl(icountry)
est store a1m5
reg ilnetpromilgood i.adjparfamadj  i.decades i.icountry if year>1990&fullwestgood==1,  cl(icountry)
est store a1m6
estout a1m1 a1m2 a1m3 a1m4 a1m5 a1m6, cells(b(star fmt(%9.3f)) se(par)) stats(r2 N, fmt(%9.3f %9.0g) labels(R-squared)) legend label collabels(none) varlabels(_cons Constant)


*APPENDIX TABLE A2: ("Predicted international partnership and military power by weighted manifesto score and mainstream vote share (or mainstream-minus-radical vote share"):
use "TBpopcountryyear.dta"
tsset countrynew year2

xi: reg f.lkofpoleconDJ ipervoteMcy3 ipervoteRRcy ipervoteRLcy l4.kofgidfma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m1
xi: reg f.lkofpoleconDJ ipervoteMminRRRLcygood3 l4.kofgidfma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m2
xi: reg f.lkofpoleconDJ lnetpartnervoteweight l4.kofgidfma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m3
xi: reg f.lmilexnew ipervoteMcy3 ipervoteRRcy ipervoteRLcy l4.lmilexnewma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m4
xi: reg f.lmilexnew ipervoteMminRRRLcygood3 l4.lmilexnewma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m5
xi: reg f.lmilexnew linetpromilvoteweight l4.lmilexnewma5 ipervote i.decades i.icountry  if fullwest==1, cl(icountry)
est store a2m6
estout a2m1 a2m2 a2m3 a2m4 a2m5 a2m6, cells(b(star fmt(%9.3f)) se(par)) stats(r2 N, fmt(%9.3f %9.0g) labels(R-squared)) legend label collabels(none) varlabels(_cons Constant)


*APPENDIX TABLE A3: ("Party’s Electoral Success as a Function of Partnership and Power in Platform"):
use "TBmpd2018ipolatepartyyear.dta"
tsset party year
xi: reg ipervote l.ipervote c.lnetpartnership  c.ilnetpromilgood i.adjparfamadj  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
est store a3m1
xi: reg ipervote l.ipervote c.lnetpartnership##i.adjparfamadj  c.ilnetpromilgood  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
est store a3m2
xi: reg ipervote l.ipervote c.lnetpartnership  c.ilnetpromilgood##i.adjparfamadj  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
est store a3m3
xi: reg ipervote l.ipervote c.lnetpartnership##i.adjparfamadj c.ilnetpromilgood##i.adjparfamadj  i.decades i.icountry if fullwestgood==1&year>1969, cl(icountry)
est store a3m4
estout a3m1 a3m2 a3m3 a3m4, cells(b(star fmt(%9.3f)) se(par)) stats(r2 N, fmt(%9.3f %9.0g) labels(R-squared)) legend label collabels(none) varlabels(_cons Constant)



* APPENDIX FIGURE A1:
use "TBpopcountryyear.dta"
sort year2
gr twoway line lnetpartnership year if year>1969&country=="United States" || line lnetpartnership year if year>1969&country=="Japan" ||line lnetpartnershipeu year if year>1969 || line lnetpartnershipMEANcntryyr year if year>1969
* subgraph saved as: "TBPopFigA1a.gph"
gr twoway line linetpromil year if year>1969&country=="United States" || line linetpromil year if year>1969&country=="Japan" ||line lnetpromil2eu year if year>1969 || line linetpromilMEANcntryyear year if year>1969
* subgraph saved as: "TBPopFigA1b.gph"

* APPENDIX FIGURE A2:
use "TBmpdyearpowerpartner.dta"
gr twoway line lnetpartnershipMviaadd year if year>1969 || line lnetpartnershipRLall year if year>1969 || line lnetpartnershipRRall year if year>1969 || line lnetpartnershipSDall year if year>1969 || line lnetpartnershipLall year if year>1969 || line lnetpartnershipCDall year if year>1969 || line lnetpartnershipCall year if year>1969
* subgraph saved as: "TBPopFigA2a.gph"
gr twoway line ilnetpromilMviaadd year if year>1969 || line ilnetpromilRRall year if year>1969 || line ilnetpromilRLall year if year>1969 || line ilnetpromilSDall year if year>1969 || line ilnetpromilLall year if year>1969 || line ilnetpromilCDall year if year>1969 || line ilnetpromilCall year if year>1969
* subgraph saved as: "TBPopFigA2b.gph"

* APPENDIX FIGURE A3:
use "TBpopcountryyear.dta"
sort year2
gr twoway line lkofpoleconDJeu year if year>1969, yaxis(3) || line lnetpartnervoteweighteu year if year>1969, yaxis(1)  || line mainminusradx3eu year if year>1969, yaxis(2)
* subgraph saved as: "TBPopFigA3a1.gph"
gr twoway line lkofpoleconDJ year if year>1969&country=="United States", yaxis(3) || line lnetpartnervoteweight year if year>1969&country=="United States", yaxis(1)  || line mainminusradx3 year if year>1969&country=="United States", yaxis(2)
*subgraph saved as: "TBPopFigA3a2.gph"
gr twoway line lkofpoleconDJ year if year>1969&country=="Japan", yaxis(3) || line lnetpartnervoteweight year if year>1969&country=="Japan", yaxis(1)  || line mainminusradx3 year if year>1969&country=="Japan", yaxis(2)
*subgraph saved as: "TBPopFigA3a3.gph"
gr twoway line lmilexneweu year if year>1969, yaxis(3) ||line linetpromilvoteweighteu year if year>1969, yaxis(1) || line mainminusradx3eu year if year>1969, yaxis(2)
* subgraph saved as: "TBPopFigA3b1.gph"
gr twoway line lmilexnew year if year>1969&country=="United States", yaxis(3) ||line linetpromilvoteweight year if year>1969&country=="United States", yaxis(1) || line mainminusradx3 year if year>1969&country=="United States", yaxis(2)
* subgraph saved as: "TBPopFigA3b2.gph"
gr twoway line lmilexnew year if year>1969&country=="Japan", yaxis(2) ||line linetpromilvoteweight year if year>1969&country=="Japan", yaxis(1) || line mainminusradx3 year if year>1969&country=="Japan", yaxis(3)
* subgraph saved as: "TBPopFigA3b3.gph"

